import java.io.File;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        //重命名
        File file=new File("d:/test/test.txt");
        file.createNewFile();
        File file1=new File("d:/test/test2.txt");
        file1.createNewFile();
        file1.renameTo(file);

    }
}
